<template>
	<view>
		<view class="module" v-for="(item,index) in list" :key="index" @click="back(item)">
			<view class="left">
				{{item.title}}
			</view>
			<view class="right">
				<u-icon name="arrow-right" size="26"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	// import {mapGetters} from 'vuex'
	export default {
		// computed:{
		// 	...mapGetters(['schoolId'])
		// },
		onLoad() {
			this.getList()
		},
		data() {
			return {
				list:[],
				addressName:'',
				addressId:'',
			}
		},
		methods: {
			back(e) {
				// uni.showLoading({
				// 	title:''
				// })
				let obj = {
					id:e.id,
					name: e.title
				}
				// this.$store.dispatch('auth/setSchoolId', obj)
				// uni.$emit('changeSchool')
				this.addressId = e.id
				this.addressName = e.title
				uni.setStorageSync('addressName',this.addressName)
				// 存储id
				uni.setStorageSync('addressId',this.addressId)
				
				setTimeout(() => {
					// uni.hideLoading()
					// uni.redirectTo({
					// 	url: '/pages/index/index'
					// })
					uni.switchTab({
						url:'/pages/index/index'
					})
					
					
					
				},500)
			},
			getList() {
				this.$req('POST',this.$api.SchoolList,{
					
				}).then(res => {
					console.log(res,'打印res')
					this.list = res.data.list
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f6f5f7;
	}
	.module{
		border-radius: 30rpx;
		background-color: #FFF;
		width: 710rpx;
		margin: 20rpx auto;
		padding:40rpx 30rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		.left{
			font-weight: bold;
			font-size: 35rpx;
		}
		.right{
			
		}
	}
</style>
